public class OopExtends {
    public static void main(String[] args) {
        Person p1 = new Person("XiaoMing", 12);
        Student s1 = new Student("XiaoHong", 20, 88);
        Student p2 = new PrimaryStudent("XiaoJun", 9, 100, 5 );
        System.out.println(p2.getScore());
    }
}

class Person {
    protected String name;
    protected int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Student extends Person{

    public Student(int score) {
        super("Unknown", 18);
        this.score = score;
    }

    protected int score;

    public Student(String name, int age, int score) {
        super(name, age);
        this.score = score;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }
}

class PrimaryStudent extends Student{
    protected int grade;

    public PrimaryStudent(int score, int grade) {
        super(score);
        this.grade = grade;
    }

    public PrimaryStudent(String name, int age, int score, int grade) {
        super(name, age, score);
        this.grade = grade;
    }

    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }
}


